cc.Class({
    extends: cc.Component,

    properties: {
        type:{
            default:[],
            type:cc.Prefab
        },
        camera:cc.Node
    },

    // use this for initialization
    onLoad: function () {
        this.poisonPool = new cc.NodePool();
        for(i in this.type){
            let poison = cc.instantiate(this.type[i]); // 创建节点
            this.poisonPool.put(poison);
        }
        
        this.schedule(this.launch,3);
    },

    launch:function() {
        let poison = this.poisonPool.get();
        if(poison){
            this.node.addChild(poison);
            let position = this.camera.convertToWorldSpaceAR(cc.Vec2.ZERO); 
            poison.getComponent('poison').init(position,this.camera.rotation,this.poisonPool);
        }
    },

    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
});
